package org.lc.cmd.impl.bridge;

import org.jline.utils.AttributedString;

import java.util.Scanner;

public class StdioHttpClientBridge extends HttpClientBridge {
    private final Scanner scanner = new Scanner(System.in);

    public StdioHttpClientBridge(String serverUrl) {
        super(serverUrl);
    }

    @Override
    public void write(AttributedString str, boolean above) {
        if (above) {
            System.out.println();
        }
        System.out.print(str.toString());
        if (above) {
            System.out.println();
        }
    }

    @Override
    public String readLine(String prompt) {
        System.out.print(prompt);
        return scanner.nextLine();
    }
}
